<template>
<!--  <dv-border-box-8>-->
    <el-main>
<!--      <el-row style="margin:10px auto;color:#260de8; font-size:1.3rem;width: 15rem" type="flex" justify="center">-->
<!--        <span> 中国疫情 </span>-->
<!--      </el-row>-->
      <el-form ref="form" :model="form" label-width="8rem" >
        <el-form-item label="展示对象">
          <label><span>{{ form.name}}</span></label>
        </el-form-item>
        <el-form-item label="时间">
          <el-date-picker disabled type="datetime" placeholder="" v-model="form.time" style="width: 100%; "/>
        </el-form-item>
        <el-form-item label="新增确诊病例">
          <label><span>{{ form.todayConfirm}}</span></label>
        </el-form-item>
        <el-form-item label="累计确诊数量">
          <label><span>{{ form.confirm}}</span></label>
        </el-form-item>
        <el-form-item label="新增本土无症状">
          <label><span>{{ form.wzzAdd}}</span></label>
        </el-form-item>

        <el-form-item label="累计无症状数量">
          <label><span>{{ form.wzz}}</span></label>
        </el-form-item>
        <el-form-item label="高风险地区数量">
          <label><span>{{ form.highRiskAreaNum}}</span></label>
        </el-form-item>
        <el-form-item label="已治愈人数">
          <label><span>{{ form.heal}}</span></label>
        </el-form-item>
        <el-form-item label="累计死亡">
          <label><span>{{ form.dead}}</span></label>
        </el-form-item>

<!--        <el-form-item label="状态">-->
<!--          <el-radio-group v-model="form.statusInfo">-->
<!--            <el-radio-button label="正常" disabled>正常</el-radio-button>-->
<!--            <el-radio-button label="检修" disabled>检修</el-radio-button>-->
<!--            <el-radio-button label="预警" disabled>预警</el-radio-button>-->
<!--          </el-radio-group>-->
<!--        </el-form-item>-->
        <el-form-item label="更新时间">
          <label><span>{{ form.updateDate}}</span></label>
        </el-form-item>
      </el-form>
    </el-main>
<!--  </dv-border-box-8>-->
</template>

<script>
import {eventBus} from '../../../assets/Bus'

export default {
  name: 'JobDetail',
  data () {
    return {
      form: {
        name: '中国疫情',
        time: new Date(),
        todayConfirm: ' ',
        confirm: '',
        wzzAdd: '',
        wzz: '',
        highRiskAreaNum: '',
        heal: '',
        dead: '',
        updateDate: new Date()
      }
    }
  },
  methods: {
    onSubmit () {
      console.log('submit!')
    }
  },
  created() {
    this.$http.get('http://localhost:8005/EpidemicData/getChinaData').then(response => {
      var data = response.data
      if (data.code == 200) {
        let item = data.data;
        this.form.name = '全国疫情'
        // this.form.time = item.updateDate
        this.form.todayConfirm = item.todayConfirm
        this.form.confirm = item.confirm
        this.form.wzzAdd = item.wzzAdd
        this.form.wzz = item.wzz
        this.form.highRiskAreaNum = item.highRiskAreaNum
        this.form.heal = item.heal
        this.form.dead = item.dead
      } else {
        console.log('失败')
      }
    })


    eventBus.$on("getEchartMapData", res => {
      var name = res.name;
      // console.log(name)
      this.$http.get('http://localhost:8005/EpidemicData/get/'+name).then(response => {
        // console.log("response:"+JSON.stringify(response))
        var data = response.data
        if (data.code == 200) {
          let item = data.data;
          this.form.name = name + '疫情'
          // this.form.time = item.updateDate
          this.form.todayConfirm = item.todayConfirm
          this.form.confirm = item.confirm
          this.form.wzzAdd = item.wzzAdd
          this.form.wzz = item.wzz
          this.form.highRiskAreaNum = item.highRiskAreaNum
          this.form.heal = item.heal
          this.form.dead = item.dead
          // this.form.curedAndDischargedCases = item.addHealingNum
          // this.form.description = item.other
        } else {
          console.log('失败')
        }
      })
    });
  }
}
</script>

<style lang="scss">
  .el-form-item__label{
    color: #260de8;
  }
  .el-form-item__content{
    width: 12rem;
  }


  .el-input.is-disabled .el-input__inner{
    color:black;
  }

  .el-textarea.is-disabled .el-textarea__inner{
    color:black;
  }

  .el-radio-button__orig-radio:disabled+.el-radio-button__inner{
    color: black;
  }

  .el-radio-button__orig-radio:disabled:checked+.el-radio-button__inner {
    background-color: #260de8;
  }
</style>
